<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\SmsWeb;
/* @var $this yii\web\View */
/* @var $searchModel common\models\SmsWebSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '站内信';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="smsweb-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a('创建站内信', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'tableOptions' => ['class' => 'table table-striped table-bordered','style'=>'width:auto;max-width:none;'],
        'options' => ['class' => 'grid-view','style'=>'overflow:auto'],
        'columns' => [
            

            'id',
            [
                'attribute' => 'user_username',
                'value' => 'user.username',
                //'filter'=> 'user.phone',
            ],//'
            'type',
            'relation_id',
            'content:ntext',
            // 'is_read',
            // 'remark',
            [
                'attribute' => 'is_read',
                'value' => function ($model, $key, $index, $column) {
                    return SmsWeb::itemAlias("is_read", $model->is_read);
                },
                'filter'=>SmsWeb::itemAlias("is_read"),
            ],   
            [
                'attribute' => 'is_delete',
                'value' => function ($model, $key, $index, $column) {
                    return SmsWeb::itemAlias("is_delete", $model->is_delete);
                },
                'filter'=>SmsWeb::itemAlias("is_delete"),
            ],   
            'create_time',
            // 'update_time',

            ['class' => 'yii\grid\ActionColumn', 'template' => '{view}',],
        ],
    ]); ?>
</div>
